package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.Help;
import com.weipai.springboot.model.HelpCate;
import com.weipai.springboot.module.dao.HelpDao;
import com.weipai.springboot.module.mapper.HelpCateMapper;
import com.weipai.springboot.module.mapper.HelpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2019/01/10 16:29
 */
@Repository
public class HelpDaoImpl implements HelpDao {
    
    @Autowired
    private HelpCateMapper helpCateMapper;
    @Autowired
    private HelpMapper helpMapper;


    @Override
    public int updateByPrimaryKeySelective(HelpCate helpCate) {
        return helpCateMapper.updateByPrimaryKeySelective(helpCate);
    }

    @Override
    public int insert(HelpCate helpCate) {
        return helpCateMapper.insert(helpCate);
    }

    @Override
    public HelpCate selectByPrimaryKey(String id) {
        return helpCateMapper.selectByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public int deleteByPrimaryKey(String id) {
        return helpCateMapper.deleteByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public List<HelpCate> list() {
        return helpCateMapper.list();
    }

    @Override
    public int updateByPrimaryKeySelectiveHelp(Help help) {
        return helpMapper.updateByPrimaryKeySelective(help);
    }

    @Override
    public int insertHelp(Help help) {
        return helpMapper.insert(help);
    }

    @Override
    public List<Map<String, Object>> listHelp(Integer start, Integer size, String type) {
        return helpMapper.listHelp(start, size, type);
    }

    @Override
    public Integer amountHelp(String type) {
        return helpMapper.amountHelp(type);
    }

    @Override
    public Help selectByPrimaryKeyHelp(String id) {
        return helpMapper.selectByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public int deleteByPrimaryKeyHelp(String id) {
        return helpMapper.deleteByPrimaryKey(Integer.parseInt(id));
    }

    @Override
    public List<Map<String, Object>> getHelpByCateId(String id) {
        return helpMapper.getHelpByCateId(id);
    }
}
